STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | List of all members
unique_ptr< _Ty[], _Dx > Class Template Reference
Inheritance diagram for unique_ptr< _Ty[], _Dx >:
_Unique_ptr_base< _Ty, _Dx >

Public Types

typedef unique_ptr< _Ty[], _Dx > _Myt
 
typedef _Unique_ptr_base< _Ty, _Dx > _Mybase
 
typedef _Mybase::pointer pointer
 
typedef _Ty element_type
 
typedef _Dx deleter_type
 
template<class _Uty >
using _Enable_ctor_reset = enable_if_t< is_same< _Uty, pointer >::value||(is_same< pointer, element_type * >::value &&is_pointer< _Uty >::value &&is_convertible< remove_pointer_t< _Uty >(*)[], element_type(*)[] >::value)>
 
template<class _Uty , class _Ex , bool _More, class _UP_pointer = typename unique_ptr<_Uty, _Ex>::pointer, class _UP_element_type = typename unique_ptr<_Uty, _Ex>::element_type>
using _Enable_conversion = enable_if_t< is_array< _Uty >::value &&is_same< pointer, element_type * >::value &&is_same< _UP_pointer, _UP_element_type * >::value &&is_convertible< _UP_element_type(*)[], element_type(*)[]>::value &&_More >
 
- Public Types inherited from _Unique_ptr_base< _Ty, _Dx >
typedef remove_reference< _Dx >::type _Dx_noref
 
typedef _Get_deleter_pointer_type< _Ty, _Dx_noref >::type pointer
 

Public Member Functions

constexpr unique_ptr () _NOEXCEPT
 
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
 unique_ptr (_Uty _Ptr) _NOEXCEPT
 
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
 unique_ptr (_Uty _Ptr, typename _If< is_reference< _Dx >::value, _Dx, const typename remove_reference< _Dx >::type & >::type _Dt) _NOEXCEPT
 
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
 unique_ptr (_Uty _Ptr, typename remove_reference< _Dx >::type &&_Dt) _NOEXCEPT
 
 unique_ptr (unique_ptr &&_Right) _NOEXCEPT
 
_Mytoperator= (_Myt &&_Right) _NOEXCEPT
 
template<class _Uty , class _Ex , class = _Enable_conversion<_Uty, _Ex, is_reference<_Dx>::value ? is_same<_Ex, _Dx>::value : is_convertible<_Ex, _Dx>::value>>
 unique_ptr (unique_ptr< _Uty, _Ex > &&_Right) _NOEXCEPT
 
template<class _Uty , class _Ex , class = _Enable_conversion<_Uty, _Ex, is_assignable<_Dx&, _Ex&&>::value>>
_Mytoperator= (unique_ptr< _Uty, _Ex > &&_Right) _NOEXCEPT
 
constexpr unique_ptr (nullptr_t) _NOEXCEPT
 
_Mytoperator= (nullptr_t) _NOEXCEPT
 
void reset (nullptr_t=nullptr_t{}) _NOEXCEPT
 
void swap (_Myt &_Right) _NOEXCEPT
 
 ~unique_ptr () _NOEXCEPT
 
_Ty & operator[] (size_t _Idx) const
 
pointer get () const _NOEXCEPT
 
 operator bool () const _NOEXCEPT
 
pointer release () _NOEXCEPT
 
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
void reset (_Uty _Ptr) _NOEXCEPT
 
 unique_ptr (const _Myt &)=delete
 
_Mytoperator= (const _Myt &)=delete
 
- Public Member Functions inherited from _Unique_ptr_base< _Ty, _Dx >
template<class _Ptr2 , class _Dx2 >
 _Unique_ptr_base (_Ptr2 _Ptr, _Dx2 &&_Dt)
 
template<class _Ptr2 >
constexpr _Unique_ptr_base (_Ptr2 _Ptr)
 
_Dx & get_deleter () _NOEXCEPT
 
const _Dx & get_deleter () const _NOEXCEPT
 
pointer_Myptr () _NOEXCEPT
 
const pointer_Myptr () const _NOEXCEPT
 

Private Member Functions

void _Delete ()
 

Additional Inherited Members

- Public Attributes inherited from _Unique_ptr_base< _Ty, _Dx >
_Compressed_pair< _Dx, pointer_Mypair
 

Member Typedef Documentation

template<class _Ty , class _Dx >
template<class _Uty , class _Ex , bool _More, class _UP_pointer = typename unique_ptr<_Uty, _Ex>::pointer, class _UP_element_type = typename unique_ptr<_Uty, _Ex>::element_type>
using unique_ptr< _Ty[], _Dx >::_Enable_conversion = enable_if_t< is_array<_Uty>::value && is_same<pointer, element_type *>::value && is_same<_UP_pointer, _UP_element_type *>::value && is_convertible<_UP_element_type(*)[], element_type(*)[]>::value && _More>
template<class _Ty , class _Dx >
template<class _Uty >
using unique_ptr< _Ty[], _Dx >::_Enable_ctor_reset = enable_if_t< is_same<_Uty, pointer>::value || (is_same<pointer, element_type *>::value && is_pointer<_Uty>::value && is_convertible< remove_pointer_t<_Uty>(*)[], element_type(*)[] >::value)>
template<class _Ty , class _Dx >
typedef _Unique_ptr_base<_Ty, _Dx> unique_ptr< _Ty[], _Dx >::_Mybase
template<class _Ty , class _Dx >
typedef unique_ptr<_Ty[], _Dx> unique_ptr< _Ty[], _Dx >::_Myt
template<class _Ty , class _Dx >
typedef _Dx unique_ptr< _Ty[], _Dx >::deleter_type
template<class _Ty , class _Dx >
typedef _Ty unique_ptr< _Ty[], _Dx >::element_type
template<class _Ty , class _Dx >
typedef _Mybase::pointer unique_ptr< _Ty[], _Dx >::pointer

Constructor & Destructor Documentation

template<class _Ty , class _Dx >
constexpr unique_ptr< _Ty[], _Dx >::unique_ptr ( )
inline
1455  : _Mybase(pointer())
1456  { // default construct
1457  static_assert(!is_pointer<_Dx>::value,
1458  "unique_ptr constructed with null deleter pointer");
1459  }
_Mybase::pointer pointer
Definition: memory:1448
Definition: type_traits:298
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
unique_ptr< _Ty[], _Dx >::unique_ptr ( _Uty  _Ptr)
inlineexplicit
1474  : _Mybase(_Ptr)
1475  { // construct with pointer
1476  static_assert(!is_pointer<_Dx>::value,
1477  "unique_ptr constructed with null deleter pointer");
1478  }
Definition: type_traits:298
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
unique_ptr< _Ty[], _Dx >::unique_ptr ( _Uty  _Ptr,
typename _If< is_reference< _Dx >::value, _Dx, const typename remove_reference< _Dx >::type & >::type  _Dt 
)
inline
1485  : _Mybase(_Ptr, _Dt)
1486  { // construct with pointer and (maybe const) deleter&
1487  }
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
unique_ptr< _Ty[], _Dx >::unique_ptr ( _Uty  _Ptr,
typename remove_reference< _Dx >::type &&  _Dt 
)
inline
1493  : _Mybase(_Ptr, _STD move(_Dt))
1494  { // construct by moving deleter
1495  static_assert(!is_reference<_Dx>::value,
1496  "unique_ptr constructed with reference to rvalue deleter");
1497  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
Definition: type_traits:247
template<class _Ty , class _Dx >
unique_ptr< _Ty[], _Dx >::unique_ptr ( unique_ptr< _Ty[], _Dx > &&  _Right)
inline
1500  : _Mybase(_Right.release(),
1501  _STD forward<_Dx>(_Right.get_deleter()))
1502  { // construct by moving _Right
1503  }
pointer release() _NOEXCEPT
Definition: memory:1420
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
template<class _Uty , class _Ex , class = _Enable_conversion<_Uty, _Ex, is_reference<_Dx>::value ? is_same<_Ex, _Dx>::value : is_convertible<_Ex, _Dx>::value>>
unique_ptr< _Ty[], _Dx >::unique_ptr ( unique_ptr< _Uty, _Ex > &&  _Right)
inline
1534  : _Mybase(_Right.release(),
1535  _STD forward<_Ex>(_Right.get_deleter()))
1536  { // construct by moving _Right
1537  }
pointer release() _NOEXCEPT
Definition: memory:1420
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
constexpr unique_ptr< _Ty[], _Dx >::unique_ptr ( nullptr_t  )
inline
1551  : _Mybase(pointer())
1552  { // null pointer construct
1553  static_assert(!is_pointer<_Dx>::value,
1554  "unique_ptr constructed with null deleter pointer");
1555  }
_Mybase::pointer pointer
Definition: memory:1448
Definition: type_traits:298
_Unique_ptr_base< _Ty, _Dx > _Mybase
Definition: memory:1447
template<class _Ty , class _Dx >
unique_ptr< _Ty[], _Dx >::~unique_ptr ( )
inline
1575  { // destroy the object
1576  _Delete();
1577  }
void _Delete()
Definition: memory:1616
template<class _Ty , class _Dx >
unique_ptr< _Ty[], _Dx >::unique_ptr ( const _Myt )
delete

Member Function Documentation

template<class _Ty , class _Dx >
void unique_ptr< _Ty[], _Dx >::_Delete ( )
inlineprivate
1617  { // delete the pointer
1618  if (get() != pointer())
1619  this->get_deleter()(get());
1620  }
_Mybase::pointer pointer
Definition: memory:1448
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
template<class _Ty , class _Dx >
pointer unique_ptr< _Ty[], _Dx >::get ( ) const
inline
1585  { // return pointer to object
1586  return (this->_Myptr());
1587  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
template<class _Ty , class _Dx >
unique_ptr< _Ty[], _Dx >::operator bool ( ) const
inlineexplicit
1590  { // test for non-null pointer
1591  return (get() != pointer());
1592  }
_Mybase::pointer pointer
Definition: memory:1448
template<class _Ty , class _Dx >
_Myt& unique_ptr< _Ty[], _Dx >::operator= ( _Myt &&  _Right)
inline
1506  { // assign by moving _Right
1507  if (this != &_Right)
1508  { // different, do the swap
1509  reset(_Right.release());
1510  this->get_deleter() = _STD move(_Right.get_deleter());
1511  }
1512  return (*this);
1513  }
void reset(nullptr_t=nullptr_t{}) _NOEXCEPT
Definition: memory:1563
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty , class _Dx >
template<class _Uty , class _Ex , class = _Enable_conversion<_Uty, _Ex, is_assignable<_Dx&, _Ex&&>::value>>
_Myt& unique_ptr< _Ty[], _Dx >::operator= ( unique_ptr< _Uty, _Ex > &&  _Right)
inline
1544  { // assign by moving _Right
1545  reset(_Right.release());
1546  this->get_deleter() = _STD forward<_Ex>(_Right.get_deleter());
1547  return (*this);
1548  }
pointer release() _NOEXCEPT
Definition: memory:1420
void reset(nullptr_t=nullptr_t{}) _NOEXCEPT
Definition: memory:1563
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
template<class _Ty , class _Dx >
_Myt& unique_ptr< _Ty[], _Dx >::operator= ( nullptr_t  )
inline
1558  { // assign a null pointer
1559  reset();
1560  return (*this);
1561  }
void reset(nullptr_t=nullptr_t{}) _NOEXCEPT
Definition: memory:1563
template<class _Ty , class _Dx >
_Myt& unique_ptr< _Ty[], _Dx >::operator= ( const _Myt )
delete
template<class _Ty , class _Dx >
_Ty& unique_ptr< _Ty[], _Dx >::operator[] ( size_t  _Idx) const
inline
1580  { // return reference to object
1581  return (get()[_Idx]);
1582  }
template<class _Ty , class _Dx >
pointer unique_ptr< _Ty[], _Dx >::release ( )
inline
1595  { // yield ownership of pointer
1596  pointer _Ans = get();
1597  this->_Myptr() = pointer();
1598  return (_Ans);
1599  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Mybase::pointer pointer
Definition: memory:1448
template<class _Ty , class _Dx >
void unique_ptr< _Ty[], _Dx >::reset ( nullptr_t  = nullptr_t{})
inline
1563  {}) _NOEXCEPT
1564  { // establish new null pointer
1565  reset(pointer());
1566  }
#define _NOEXCEPT
Definition: yvals.h:25
void reset(nullptr_t=nullptr_t{}) _NOEXCEPT
Definition: memory:1563
_Mybase::pointer pointer
Definition: memory:1448
template<class _Ty , class _Dx >
template<class _Uty , class = _Enable_ctor_reset<_Uty>>
void unique_ptr< _Ty[], _Dx >::reset ( _Uty  _Ptr)
inline
1604  { // establish new pointer
1605  pointer _Old = get();
1606  this->_Myptr() = _Ptr;
1607  if (_Old != pointer())
1608  this->get_deleter()(_Old);
1609  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Mybase::pointer pointer
Definition: memory:1448
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
template<class _Ty , class _Dx >
void unique_ptr< _Ty[], _Dx >::swap ( _Myt _Right)
inline
1569  { // swap elements
1570  _Swap_adl(this->_Myptr(), _Right._Myptr());
1571  _Swap_adl(this->get_deleter(), _Right.get_deleter());
1572  }
pointer & _Myptr() _NOEXCEPT
Definition: memory:1261
_Dx & get_deleter() _NOEXCEPT
Definition: memory:1251
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
constexpr const _Ty &() _Right
Definition: algorithm:3591

The documentation for this class was generated from the following file: